<template>
	<view class="page" :style="themeColor">
		<!---flex布局flex布局开始-->
		<view class="flex flex-wrap align-center justify-center benben-flex-layout forgetPwd_flex_0">
			<image class='forgetPwd_fd0_0' mode="aspectFit" :src='STATIC_URL+"2.png"'></image>
		</view>

		<!---flex布局flex布局结束-->

		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout forgetPwd_flex_1">
			<view class='flex flex-wrap align-center forgetPwd_fd1_0'>
				<image class='forgetPwd_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"3.png"'></image>
				<input class='flex-sub forgetPwd_fd1_0_c1' type="number" placeholder="请输入手机号" confirm-type="done"
					:maxlength="11" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" v-model="mobile" />
			</view>
			<view class='flex flex-wrap align-center forgetPwd_fd1_0'>
				<image class='forgetPwd_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"5.png"'></image>
				<input class='flex-sub forgetPwd_fd1_0_c1' type="number" placeholder="请输入验证码" confirm-type="done"
					:maxlength="4" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" v-model="code" />
				<benben-send-verification-code class='flex  forgetPwd_fd1_1_c2' after-text='后重新获取' before-text='获取验证码'
					type='2' :phone="mobile"></benben-send-verification-code>
			</view>
			<view class='flex flex-wrap align-center forgetPwd_fd1_0'>
				<image class='forgetPwd_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"4.png"'></image>
				<benben-flex-password-diy v-model="password"
					class-name="flex align-center flex-sub flex forgetPwd_fd1_2_c1" :placeholder="'请输入密码(6~12位字母+数字)'"
					:maxlength="12" :default-type='true'
					placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx">
					<template #show>
						<text class='fu-iconfont2  forgetPwd_fd1_2_c1_icon1' data-type="show">&#xE837;</text>
					</template>
					<template #hide>
						<text class='fu-iconfont2  forgetPwd_fd1_2_c1_icon2' data-type="hide">&#xEBCC;</text>
					</template>
				</benben-flex-password-diy>
			</view>
			<view class='flex align-center justify-center forgetPwd_fd1_3'>
				<button class='forgetPwd_fd1_3_c0' @tap.stop="resetPwdFunc()">确定</button>
			</view>
		</view>

	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"password": "",
				"mobile": "",
				"code": "",
				"account_type": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//重置密码
			async resetPwdFunc() {
				if (!validate(this.mobile, 'require')) {
					this.$message.info('手机号不能为空');
					return false;
				}
				if (!validate(this.mobile, 'phone')) {
					this.$message.info('请输入正确的手机号');
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info('验证码不能为空');
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info('验证码错误');
					return false;
				}
				if (!validate(this.password, 'require')) {
					this.$message.info('密码不能为空');
					return false;
				}
				if (!validate(this.password, 'password')) {
					this.$message.info('请输入6-12位字母+数字密码');
					return false;
				}
				//请求方法
				//数据验证

				let data5caeeba9866aa = await this.$api.post(global.apiUrls.post5caeeba9866aa, {
					password: this.password,
					account: this.mobile,
					code: this.code,
					type: '2',
					account_type: 'mobile'
				});

				if (data5caeeba9866aa.data.code != 1) {
					this.$message.info(data5caeeba9866aa.data.msg);
					return
				}
				this.$message.info('密码重置成功');
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/tabBar/login/login'
					})
				}, 800)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto !important;
	}

	.forgetPwd_flex_0 {
		background: url(/static/images/1.png) no-repeat, transparent;
		height: 600rpx;
		background-size: 100% auto !important;
	}

	.forgetPwd_fd0_0 {
		width: 295rpx;
		height: 82rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.forgetPwd_flex_1 {
		margin: -150rpx 0rpx 0rpx 0rpx;
	}

	.forgetPwd_fd1_3_c0 {
		background: rgba(205, 150, 45, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 500;
		width: 638rpx;
	}

	.forgetPwd_fd1_3 {
		margin: 98rpx 0rpx 0rpx 0rpx;
	}

	.forgetPwd_fd1_2_c1_icon2 {
		text-align: center;
		font-size: 44rpx;
	}

	.forgetPwd_fd1_2_c1_icon1 {
		text-align: center;
		font-size: 44rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	::v-deep .forgetPwd_fd1_2_c1 {
		font-size: 28rpx;
		color: #333;
		font-weight: 400;
		width: 628rpx;
	}

	.forgetPwd_fd1_1_c2 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(0, 91, 196, 1);
		line-height: 40rpx;
	}

	.forgetPwd_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.forgetPwd_fd1_0_c0 {
		width: 40rpx;
		height: 40rpx;
		margin: 0rpx 22rpx 0rpx 0rpx;
	}

	.forgetPwd_fd1_0 {
		border-bottom: 1px solid #eee;
		padding: 40rpx 0rpx 40rpx 0rpx;
		margin: 0rpx 30rpx 0rpx 28rpx;
	}
</style>